Thực đơn
Mã hóa Huffman Bài toánBảng n {\displaystyle n} chữ cái A = { a 1 , a 2 , ⋯ , a n } {\displaystyle A=\left\{a_{1},a_{2},\cdots ,a_{n}\right\}} .
Tập các trọng số (tần suất xuất hiện) tương ứng W = { w 1 , w 2 , ⋯ , w n } {\displaystyle W=\left\{w_{1},w_{2},\cdots ,w_{n}\right\}} , ví dụ: w i = w e i g h t ( a i ) , 1 ≤ i ≤ n {\displaystyle w_{i}=\mathrm {weight} \left(a_{i}\right),1\leq i\leq n} .
Bộ mã C ( A , W ) = { c 1 , c 2 , ⋯ , c n } {\displaystyle C\left(A,W\right)=\left\{c_{1},c_{2},\cdots ,c_{n}\right\}} , là tập hợp các từ mã (codeword) (nhị phân), trong đó c i {\displaystyle c_{i}} là từ mã của a i , 1 ≤ i ≤ n {\displaystyle a_{i},1\leq i\leq n} .
Yêu cầuĐặt L ( C ) = ∑ i = 1 n w i × l e n g t h ( c i ) {\displaystyle L\left(C\right)=\sum _{i=1}^{n}{w_{i}\times \mathrm {length} \left(c_{i}\right)}} là trọng số của bộ mã C {\displaystyle C} . Điều kiện là: L ( C ) ≤ L ( T ) {\displaystyle L\left(C\right)\leq L\left(T\right)} với mọi bộ mã T ( A , W ) {\displaystyle T\left(A,W\right)} .
Input | Ký tự | a | b | c | d | e | |
---|---|---|---|---|---|---|---|
tần suất | 0.10 | 0.15 | 0.30 | 0.16 | 0.29 | 1,00 | |
Mã 1 | Từ mã | 000 | 001 | 010 | 011 | 110 | |
Độ dài từ mã (bits) | 3 | 3 | 3 | 3 | 3 | 3,00 | |
Mã 2 | Từ mã | 000 | 001 | 10 | 01 | 11 | |
Độ dài từ mã (bits) | 3 | 3 | 2 | 2 | 2 | 2,25 |
Thực đơn
Mã hóa Huffman Bài toánLiên quan
Mã Mã di truyền Mã Siêu Mã số điện thoại quốc tế Mãn Châu Quốc Mã Morse Mã Gia Kỳ Mã vạch Mãn Châu Mã hóa video hiệu quả caoTài liệu tham khảo
WikiPedia: Mã hóa Huffman http://www.cs.sfu.ca/cs/CC/365/li/squeeze http://wiki.cc/php/?title=Huffman http://www.research.att.com/projects/OEIS?Anum=A09... http://alexvn.freeservers.com/s1/huffman_template_... http://www.huffmancoding.com/david/algorithm.html http://www.huffmancoding.com/david/scientific.html http://www.informatik.uni-trier.de/~ley/db/conf/st... http://www.cs.duke.edu/csed/poop/huff/info/ http://web-cat.cs.vt.edu/AlgovizWiki/HuffmanCoding... http://semillon.wpi.edu/~aofa/AofA/msg00040.html